package edu.ar.modulo4.ejb.ws;

import javax.annotation.Resource;
import javax.annotation.security.PermitAll;
import javax.ejb.Stateless;
import javax.jws.WebMethod;
import javax.jws.WebService;

/**
 * Session Bean implementation class ConverterWS
 */
@Stateless
@PermitAll
@WebService
public class ConverterWS {

	@Resource(name = "cotizacionDolar")
	private Double COTIZACION_DOLLAR;
	
	@Resource(name = "cotizacionEuro")
	private Double COTIZACION_EURO;
	
    /**
     * Default constructor. 
     */
    public ConverterWS() {
    }
   
    @WebMethod
    public Double convertPesosToDollar(Double amount) {

		return amount * COTIZACION_DOLLAR;
	}

    @WebMethod
	public Double convertPesosToEuro(Double amount) {
		
		return amount * COTIZACION_EURO;
	}

    @WebMethod
	public Double convertDollarToPesos(Double amount) {

		return amount * (1/COTIZACION_DOLLAR);
	}

    @WebMethod
	public Double convertEuroToPesos(Double amount) {
		
		return amount * (1/COTIZACION_EURO);
	}

}
